package com.woniuxy.yoga.order.client;

import com.woniuxy.yoga.commons.core.model.PageInfo;
import com.woniuxy.yoga.commons.core.model.Result;
import com.woniuxy.yoga.feign.config.FeignConfig;
import com.woniuxy.yoga.order.model.dto.UserInfoDto;
import com.woniuxy.yoga.order.model.form.SelectUsersByIdsForm;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

@FeignClient(name = "user-service",configuration = FeignConfig.class,path = "/user")
public interface UserClient {

    /**
     * 根据id查询用户信息
     * @param userId 用户id
     * @return 用户信息对象
     */
    @GetMapping("/userInfo/getByUserId/{userId}")
    Result<UserInfoDto> getByUserId(@PathVariable("userId") Integer userId);

    /**
     * 通过用户id集合查询用户信息
     * @param form 参数
     * @return pageinfo
     */
    @PostMapping("/userInfo/selectUsersByIds")
    Result<PageInfo> selectUsersByIds(@RequestBody SelectUsersByIdsForm form);
}
